package practice.library.scala_scraper

import utility.CustomLogger


/**
  * Created by lovepocky(lovepocky@foxmail.com) on 2016/6/15.
  */
object ScalaScraperMain extends CustomLogger {
	
	import net.ruippeixotog.scalascraper.browser.JsoupBrowser
	import net.ruippeixotog.scalascraper.dsl.DSL._
	import net.ruippeixotog.scalascraper.dsl.DSL.Extract._
	
	val browser = JsoupBrowser()
	lazy val rome = browser.get("http://place.qyer.com/rome/")
	
	def main(args: Array[String]) {
		//test()
		extractTest()
	}
	
	
	def test() = {
		(rome >> elementList("meta[property=\"og:url\"]")).foreach(println)
		
	}
	
	def extractTest() = {
		loggers.console.info("English Name Of Place")
		(rome >> element("p[class=\"plcTopBarNameEn\"]")).children.foreach(println)
		
		loggers.console.info("Chinese Name Of Place")
		(rome >> element("p[class=\"plcTopBarNameCn fontYaHei\"]")).children.foreach(println)
	}
}
